#include "stopword.h"
#include "spliter.h"

StopWord::StopWord(void)
{
	_filePath = "StopWord_en.txt";
}


StopWord::~StopWord(void)
{
}



bool StopWord::isStopWord(std::string &str)
{ 

	wordFiltered = loadWordList(str);

	vector<string>::iterator iter;
	for (iter = wordFiltered.begin(); iter != wordFiltered.end(); ++iter)
	{
		if(*iter == str)
			return true;
	}
	return false;
}


vector<string> StopWord::loadWordList(string &str)
{
	ifstream instem;
	instem.open(_filePath.c_str());
	string word;
	vector<string> wList;

	while(instem >> word)
	{
		wList.push_back(word);
	}
	return wList;
}
